package com.spring.study.bean.factory;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class UserFactoryImpl implements UserFactory, InitializingBean, DisposableBean {

    //1，基于@PostConstrct注解
    @PostConstruct
    public void init() {
        System.out.println("UserFactorys初始化中。。。");
    }

    //自定义初始化方法
    public void initUserFactory() {
        System.out.println("自定义初始化方法。。。。。。");
    }

    //实现spring的InitializingBean初始化Bean
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet >>>>>>..初始化中。。。");
    }

    @PreDestroy
    public void preDestry() {
        System.out.println("bean的注解PreDestroy销毁中。。。。");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("destroy实现接口销毁》》》》》》");
    }

    public void doDestroy() {
        System.out.println("自定义销毁方法。。。。。。");
    }
}
